import sbt._
import Keys._

import java.io.File

object Snout extends Build {

  lazy val projectSettings = Defaults.defaultSettings ++ Seq(
    name := "Snout",
    version := "0.0.1",
    organization := "net.oschina.oldpig",
    scalaVersion := "2.10.2",
    resolvers ++= Seq(
      "sonatype-snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
      "sonatype-releases" at "http://oss.sonatype.org/content/repositories/releases",
      "typesafe-releases" at "http://repo.typesafe.com/typesafe/sonatype-releases",
      "typesafe-snapshots" at "http://repo.typesafe.com/typesafe/sonatype-snapshots"
    ),
    scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-language:implicitConversions"),
//    javacOptions ++= Seq("-Xlint:deprecation", "-Xlint:unchecked"),
//    compileOrder in Compile := CompileOrder.JavaThenScala,
    javaSource in Compile <<= baseDirectory(_ / "src"),
    resourceDirectory in  Compile <<= baseDirectory(_ / "src"),
    scalaSource in Compile <<= baseDirectory(_ / "src"),
    scalaSource in Test <<= baseDirectory(_ / "test"),
    javaHome := Some(new File(System.getenv("JAVA_HOME"))),
    unmanagedJars in Compile <+= javaHome map { jh: Option[File] =>
      Attributed.blank(new File(jh.get, "/jre/lib/jfxrt.jar"))
    },
    fork in run := true,
    libraryDependencies ++= {
      Seq(
        "org.scalaz" %% "scalaz-core" % "7.0.0",
        "org.scalatest" %% "scalatest" % "1.9.1" % "test",
        "com.typesafe" %% "scalalogging-log4j" % "1.1.0-SNAPSHOT" notTransitive(),
        "org.json4s" %% "json4s-native" % "3.2.5",
        "org.apache.logging.log4j" % "log4j-api" % "2.0-beta7",
        "org.apache.logging.log4j" % "log4j-core" % "2.0-beta7",
        "com.google.guava" % "guava" % "14.0.1"
      )
    }
  )


  lazy val root = Project(id = "Snout", base = file("."), settings = projectSettings)
}

